/*
 * AcceptorListener.java    0.0.1    25/set/2009
 * 
 * Copyright (c) 2009 mentalsmash.org
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 * The use of the Apache License does not indicate that this project is
 * affiliated with the Apache Software Foundation.
 */ 
package org.mentalsmash.tazio.net.cs.server.impl;

/**
 * Use this interface to receive notifications about the status of an 
 * {@link org.mentalsmash.tazio.net.cs.server.impl.Acceptor Acceptor}.
 * <p>
 * You must register this lister prior to receiving notification, calling
 * the method
 * {@link org.mentalsmash.tazio.net.cs.server.impl.Acceptor#registerListener registerListener()}
 * on an instance of {@link org.mentalsmash.tazio.net.cs.server.impl.Acceptor Acceptor}
 * </p>
 * @version    0.0.1    25/set/2009    
 * @author     Andrea Reale <andrea.reale@gmail.com>
 * @see        org.mentalsmash.tazio.net.cs.server.impl.Acceptor Acceptor
 */
public interface AcceptorListener {
	/**
	 * This callback method is called when the acceptor has completed
	 * is boot routine and is going to start to listen for external
	 * connections
	 * <p>
	 * This method is usually called by the thread who made the acceptor thread
	 * start.
	 * </p>
	 */
	void acceptorStarted();
	/**
	 * This callback method is called when the acceptor stops either because of
	 * an external interrupt or an exception.
	 * <p>
	 * This method is usually called by the acceptor thread itself
	 * </p>
	 * @param cause The exception that caused the acceptor to stop. Notice that
	 * for "normal" stops this is an <tt>InterruptedException</tt>
	 */
	void acceptorStopped(Throwable cause);
}
